<?php
if(function_exists('date_default_timezone_set'))
   date_default_timezone_set("Asia/Ho_Chi_Minh");
else
   putenv("TZ=Asia/Ho_Chi_Minh");
function random_str($len = 5) {
	$s = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
	mt_srand ((double)microtime() * 1000000);
	$unique_id = '';
	for ($i=0;$i< $len;$i++)
		$unique_id .= substr($s, (mt_rand()%(strlen($s))), 1);
	return $unique_id;
}
function curl_cook($url){
 $agents[] = "Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8.1.18) Gecko/20081203 Firefox/2.0.0.18";
 $agents[] = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.16) Gecko/20080702 Firefox/2.0.0.16";
 $agents[] = "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1";
	 $ch=curl_init();
	 curl_setopt ($ch, CURLOPT_URL, $url); 
     curl_setopt ($ch, CURLOPT_USERAGENT, $agents[rand(0,(count($agents)-1))]); 
	 curl_setopt($ch, CURLOPT_COOKIESESSION, 1);
     curl_setopt ($ch, CURLOPT_COOKIEJAR, "cbi-bin.txt");
	 curl_setopt($ch, CURLOPT_COOKIEFILE, "cbi-bin.txt");
	 curl_setopt($ch, CURLOPT_REFERER, "http://www.youtube.com/");
     curl_setopt ($ch, CURLOPT_HEADER, 1); 
     curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); 
    // curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
     curl_setopt ($ch, CURLOPT_TIMEOUT, 120);
     $result = curl_exec ($ch);
     curl_close($ch);
	 return	$result;
}
function get_by_curl($url,$post='',$vars='',$user_agent=''){
if(!$user_agent) $user_agent="User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6";
    $ch = curl_init(); 
    curl_setopt ($ch, CURLOPT_URL, $url); 
    curl_setopt ($ch, CURLOPT_USERAGENT, $user_agent);  
if($post){
    curl_setopt ($ch , CURLOPT_POST , 1) ; 
    curl_setopt ($ch, CURLOPT_POSTFIELDS, $vars); 
}
    curl_setopt ($ch, CURLOPT_HEADER, 1);
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); 
    //curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt ($ch, CURLOPT_TIMEOUT, 120);
    $result = curl_exec ($ch);
    curl_close($ch);
return $result;
}
$ht=date("dth");
$id=$_GET['id'];
$idde=base64_decode($id);
$idde=str_replace($ht,'',$idde);
$data=curl_cook('http://www.youtube.com/view_play_list?p='.$idde);
preg_match_all('#a id="video-long-title-(.*?)"#', $data, $t_mat);

$xml = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Phim Online | Phim Trực Tuyến | Phim Rạp | Phim Kinh Điển | phim Bộ, phim lẻ, phim Điện Ảnh, Lịch chiếu phim - 360Do.cc</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Language" content="UTF-8" />
<meta name="author" content="RJMEDIA" />
<meta name="description" content="rjmedia, 360do.cc, mp3, music, singer, album, single, phim, online, phim truc tuyen, download, trailer, full, the gioi phim, movie, movies, vietnam, viet nam, quoc te, my, han quoc, hong kong, trung quoc, hanh dong, tinh cam, kinh di, tam ly, phim anh, dien vien dien anh, phimanh, tai phim, mien phi, free, hay, hot, moi, new, nong, phim cap 3, phim nguoi lon" />
<meta name="keywords" content="rjmedia,360Do.cc, mp3, music, singger, album, single, phim, online, phim truc tuyen, download, trailer, full, the gioi phim, movie, movies, vietnam, viet nam, quoc te, my, han quoc, hong kong, trung quoc, hanh dong, tinh cam, kinh di, tam ly, phim anh, dien vien dien anh, phimanh, tai phim, mien phi, free, hay, hot, moi, new, nong, phim cap 3, phim nguoi lon" />
<meta name="ROBOTS" content="index, follow">
<link rel="shortcut icon" type="image/x-icon" href="/movie/favicon.ico" />
</head>
<body>';
for($i=0;$i<=count($t_mat[0])-1;$i++){
$a=random_str(3);
$b=random_str(2);
$c=random_str(1);
$vlt=substr($t_mat[1][$i],0,-1);
$nkute=substr($t_mat[1][$i],10);
$iden=$a.$vlt.$b.$nkute.$c;
$xml .= 'Link Part '.$i.' <i>===></i> <a href="http://grab.haiduongvui.com/pyoutube.php?id='.base64_encode($iden).'"><b>CLICK HERE</b></a><br />';
}
$xml .= '</body>'.
	'</html>';
echo $xml;
?>